package com.szrt.java.day20161229.demo05;

public class Tank {

	private String name;
	private double price;
	private double speed;
	private double weight;

	public boolean shoot(String name,int distance){
		
		String ddn =name;
		int temp =0;
		
		if(ddn.equals("飞毛腿导弹")){
			temp = 5000;
		}else if(ddn.equals("爱国者导弹")){
			temp = 3000;
		}
		
		if(temp>=distance){
			System.out.println(name+"打得中"+distance+"M的目标！"+name+"最远能打中"+temp+"M的距离。");
			return true;
		}else if(temp<distance){
			System.out.println(name+"打不中"+distance+"M的目标！"+name+"最远能打中"+temp+"M的距离。");
		}
		return false;
		
	}
	
	public Tank() {
		System.out.println("调用了有参的构造函数！...无参");
	}
	
	public Tank(String name,double price,double speed,double weight) {
		this.name = name;
		this.price = price;
		this.speed = speed;
		this.weight = weight;
		System.out.println("调用了有参的构造函数！...有参");
	}
	
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	
	public double getPrice() {
		return price;
	}
	public void setPrice(double price) {
		this.price = price;
	}
	
	public double getSpeed() {
		return speed;
	}
	public void setSpeed(double speed) {
		this.speed = speed;
	}
	
	public double getWeight() {
		return weight;
	}
	public void setWeight(double weight) {
		this.weight = weight;
	}
	
	
	
	@Override
	public String toString() {
		return "Tank [name=" + name + ", price=" + price + ", speed=" + speed + ", weight=" + weight + "]";
	}
	

}
